package socket.sc;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.Socket;

public class Read implements Runnable {
	private String rd;
	private Socket socket;

	public Read(Socket socket) {
		this.socket = socket;
	}

	@Override
	public void run() {
		try {
			ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
			do{
			rd = (String) in.readObject();// 从网络上接收信息
			System.out.println("客户端说:" + rd);
			}while(!rd.equals("bye"));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
